#! /usr/bin/python
# -*- coding: utf-8 -*-

from sympy import *
from mymatrix import str_to_list
str = raw_input(u"Input matrix 2x2 or 3x3 for multiplication:\n")
str = str+"#"
list = str_to_list(str)
size = 0
if len(list) == 4:
    size = 2
elif len(list) == 9:
    size = 3
else:
    print u"Wrong input\n"
    exit()
m = Matrix(size,size,list)
A = Symbol("A")
mcur = m
for i in xrange(1, 6):
    pprint(A**i)
    pprint (mcur)
    print
    mcur*=m
    

